package com.wanglianyun.controller;

import com.wanglianyun.request.RegisterRequest;
import com.wanglianyun.service.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class HelloController {

    @Autowired
    private RegisterService registerService;

    @GetMapping("/hello")
    public String hello1(@RequestParam String id, @RequestParam Boolean b) {
        System.out.println("hello world");

        //当前业务处理结束之后发布一个事件
        registerService.register(new RegisterRequest("生活好难"));

        return "hello world";
    }
}